package com.jcl.recruit.api.org.controller;

import com.jcl.recruit.org.model.Department;
import com.jcl.recruit.org.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 刘明新
 * @date 2018/8/2 下午2:12
 */
@RestController
@RequestMapping("/api/department/")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/getall")
    public Map<String,Object> getall(Integer subcompany_id,Integer super_id,String keyword){
        Map<String,Object> map = new LinkedHashMap<>();
        List<Department> departments = departmentService.selectDepartmentListsBySupperIdAndCompanyIdAndKeyword(super_id,subcompany_id,keyword);
        map.put("type","success");
        map.put("message","执行成功");
        map.put("departments",departments);
        return map;
    }
}
